const Koa = require('koa');
const app = new Koa();

const main = ctx => {
  // console.log(ctx.req);
  // console.log(ctx.req.url);
  // console.log(ctx.request.url);
  // console.log(ctx.url);

  // ctx.res.end('Hello, world!');
  // ctx.response.body = 'Hello, world!';
  ctx.body = 'Hello, world!';
};

app.use(main);

app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

// {
//   request: {
//     method: 'GET',
//     url: '/',
//     header: {
//       host: 'localhost:3000',
//       connection: 'keep-alive',
//       'cache-control': 'max-age=0',
//       'sec-ch-ua': '"Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"',
//       'sec-ch-ua-mobile': '?0',
//       'sec-ch-ua-platform': '"Windows"',
//       'upgrade-insecure-requests': '1',
//       'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',
//       accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
//       'sec-fetch-site': 'none',
//       'sec-fetch-mode': 'navigate',
//       'sec-fetch-user': '?1',
//       'sec-fetch-dest': 'document',
//       'accept-encoding': 'gzip, deflate, br, zstd',
//       'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7'
//     }
//   },
//   response: {
//     status: 404,
//     message: 'Not Found',
//     header: [Object: null prototype] {}
//   },
//   app: { subdomainOffset: 2, proxy: false, env: 'development' },
//   originalUrl: '/',
//   req: '<original node req>',
//   res: '<original node res>',
//   socket: '<original node socket>'
// }
